import { defineStore } from "pinia";

export const usePluginStore = defineStore("plugin", {
  state: () => ({
    pluginInfo: {
      name: "",
      version: "",
      description: "",
    },
  }),
  actions: {
    getPluginInfo() {
      try {
        const manifest: any = chrome.runtime.getManifest();
        if (manifest) {
          this.pluginInfo = manifest;
        }
      } catch (err) {
        console.error("获取manifest失败:", err);
      }
    },
  },
});
